#!/usr/bin/env python
# -*- coding:utf-8 -*-

# file:homework5_2.py
# author:wmf
# datetime:2021/4/14 19:49
# software: PyCharm
'''
this is function description
'''
# import module your need


# 2  编写一个装饰器，能记录其他函数调用的日志，将日志写入到文件中；
import time,functools


def log(func):
    @functools.wraps(func)
    def wrapper(*args,**kw):
        print("call %s():" % func.__name__)
        with open('name.txt','a') as f:
            f.write(func.__name__)
        return func(*args,**kw)
    return wrapper


@log
def sleep_time():
    time.sleep(5)
    print("休眠五秒钟")


sleep_time()

